package com.yanqu.road.entity.activity.unionwar;

import com.alibaba.fastjson.JSON;
import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.FieldTypeAnnotation;
import com.yanqu.road.entity.union.UnionBaseInfo;

import java.util.List;
import java.util.Objects;

/**
 * 商会战-每轮次商会成员信息(包含结果)
 */
@FieldTypeAnnotation(tableName = "t_u_activity_unionwar_union_member")
public class UnionWarUnionMember extends DataObject {

    /**
     * 活动id
     */
    @FieldTypeAnnotation(select = true, update = true, desc = "活动id")
    private int activityId;
    /**
     * 商会id
     */
    @FieldTypeAnnotation(update = true, desc = "商会id")
    private String unionUid;
    /**
     * 阶段（积分赛、决赛）
     */
    @FieldTypeAnnotation(update = true, desc = "阶段（积分赛、决赛）")
    private int phase;
    /**
     * 场次
     */
    @FieldTypeAnnotation(update = true, desc = "场次")
    private int session;
    /**
     * 商会基础信息
     */
    @FieldTypeAnnotation(desc = "商会基础信息")
    private UnionBaseInfo unionBaseInfo;
    /**
     * 成员
     */
    @FieldTypeAnnotation(desc = "成员")
    private List<Long> userIdList;


    public int getActivityId() {
        return activityId;
    }

    public void setActivityId(int activityId) {
        if(this.activityId != activityId) {
            this.activityId = activityId;
            setUpdateOption();
        }
    }

    public String getUnionUid() {
        return unionUid;
    }

    public void setUnionUid(String unionUid) {
        if(!Objects.equals(this.unionUid, unionUid)) {
            this.unionUid = unionUid;
            setUpdateOption();
        }
    }

    public int getSession() {
        return session;
    }

    public void setSession(int session) {
        if(this.session != session) {
            this.session = session;
            setUpdateOption();
        }
    }

    public int getPhase() {
        return phase;
    }

    public void setPhase(int phase) {
        if(this.phase != phase) {
            this.phase = phase;
            setUpdateOption();
        }
    }

    public String getUnionBaseInfoJsonStr(){
        if(null == unionBaseInfo){
            return "";
        }else {
            return JSON.toJSONString(unionBaseInfo);
        }
    }

    public UnionBaseInfo getUnionBaseInfo() {
        return unionBaseInfo;
    }

    public void setUnionBaseInfo(UnionBaseInfo unionBaseInfo) {
        this.unionBaseInfo = unionBaseInfo;
        setUpdateOption();
    }

    public List<Long> getUserIdList() {
        return userIdList;
    }

    public void setUserIdList(List<Long> userIdList) {
        this.userIdList = userIdList;
        setUpdateOption();
    }
}
